package com.chaike.hsq.consts;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 慧收钱 公共 枚举.
 *
 * @author Luo
 * @version 1.0
 * @date 2021-12-23 16:07
 */
public class HsqCommonEnum {

    /**
     * 文件上传返回状态.
     *
     * @author Luo
     * @version 1.0
     * @date 2021-10-21 10:55
     */
    @Getter
    @AllArgsConstructor
    public enum UploadStatus {

        /**
         * 初始化.
         */
        INIT("INIT", "初始化"),

        /**
         * 处理中.
         */
        PROCESSING("PROCESSING", "处理中"),

        /**
         * 成功.
         */
        SUCCESS("SUCCESS", "成功"),

        /**
         * 失败.
         */
        FAIL("FAIL", "失败"),

        /**
         * 完成.
         */
        FINISHED("FINISHED", "完成");

        /**
         * status.
         */
        private final String status;

        /**
         * 说明.
         */
        private final String explain;

        /**
         * 根据status获取.
         *
         * @param status status
         * @return 结果
         */
        public static UploadStatus getByStatus(final String status) {
            return Arrays.stream(UploadStatus.values()).filter(i -> i.getStatus().equals(status)).findFirst().orElse(null);
        }

    }

}
